import {Component} from '@angular/core';
import DeviceService from "@app/shared/service/device.service";
import {PageLink} from "@app/shared/models/PageLink";
import Store from "@app/shared/Store";

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrl: './home.component.scss'
})
export class HomeComponent {
  percentage = Store.WHPercentage
  activeIndex: number = 1;

  constructor(private deviceService: DeviceService) {
  }

  ngOnInit() {
    console.log('home ngOnInit')
    // this.deviceService.getTenantDeviceInfos(new PageLink(10,0)).subscribe(res=>{
    //   console.log(res)
    // })
  }
  tabItems: string[] = ['能源应用', '能源调度','能源分析','能源预测','能源报告','告警管理','费用核算','数据监控'];
  tabMap: { [key: string]: number } = this.getTabMap(this.tabItems)

  tabClick(index: number) {
    this.activeIndex = index;
  }

  getTabMap(tabItems: string[]) {
    const map: { [key: string]: number } = {}
    tabItems.forEach((item, index) => {
      map[item] = index
    })
    return map;
  }
}
